package br.edu.JUniversity.interceptor;

import java.util.Locale;
import java.util.Map;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;  
import com.opensymphony.xwork2.interceptor.Interceptor;  

public class LocaleInterceptor implements Interceptor {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	 
    @Override  
    public String intercept(ActionInvocation invocation) throws Exception {  
    	Map session = ActionContext.getContext().getSession();
		Locale language = new Locale((String)session.get("idioma"));
		ActionContext.getContext().setLocale(language);
    	return invocation.invoke();  
    }


	@Override
	public void destroy() {
		// TODO Auto-generated method stub
	}

	@Override
	public void init() {
		// TODO Auto-generated method stub
	}  	
}
